package com.cleaningcloud.cld.controller.mini;

import com.cleaningcloud.cld.domain.CldTemporary;
import com.cleaningcloud.cld.domain.CldTemporaryReply;
import com.cleaningcloud.cld.domain.vo.CldTemporaryVo;
import com.cleaningcloud.cld.service.mini.IMiniTemporaryService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.web.page.TableDataInfo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * packageName com.cleaningcloud.cld.controller.mini
 *
 * @author Shaw
 * @version JDK 8
 * @className MiniTemporaryController
 * @date 2025-06-19
 * @description 临时工作安排 - 小程序接口
 */
@RestController
@RequestMapping("/mini/temporary")
public class MiniTemporaryController extends BaseController {

    @Autowired
    private IMiniTemporaryService  miniTemporaryService;

    /**
     * @Author Shaw
     * @Description //客户发起临时工作安排
     * @date: 2025-06-19 9:30
     * @param: //TODO
     */
    @Operation(description = "客户发起临时工作安排")
    @PostMapping("/addTemporary")
    public AjaxResult addTemporary(@RequestBody CldTemporary cldTemporary) {
        return toAjax(miniTemporaryService.insertCldTemporary(cldTemporary));
    }

    /**
     * @Author Shaw
     * @Description 获取临时工作安排列表
     * @date: 2025-05-28 16:00
     * @param: //TODO
     */
    @Operation(description = "获取临时工作安排列表")
    @GetMapping("/getTemporaryList")
    public TableDataInfo getTemporaryList(CldTemporaryVo cldTemporaryVo) {
        startPage();
        List<CldTemporaryVo> list = miniTemporaryService.getTemporaryList(cldTemporaryVo);
        return getMiniDataTable(list);
    }

    /**
     * @Author Shaw
     * @Description //根据工作安排ID查看详情
     * @date: 2025-06-19 9:30
     * @param: //TODO
     */
    @Operation(description = "查看详情")
    @GetMapping("/getTemporaryInfo/{temporaryId}")
    public AjaxResult getTemporaryInfo(@PathVariable Long temporaryId) {
        return success(miniTemporaryService.getTemporaryInfo(temporaryId));
    }

    /**
     * @Author Shaw
     * @Description //下发整改
     * @date: 2025-06-19 9:30
     * @param: //TODO
     */
    @Operation(description = "下发整改")
    @PutMapping("/IssueRectification")
    public AjaxResult IssueRectification(@RequestBody CldTemporaryVo cldTemporaryVo) {
        return success(miniTemporaryService.IssueRectification(cldTemporaryVo));
    }

    /**
     * @Author Shaw
     * @Description 立即反馈
     * @date: 2025-06-20 9:31
     * @param: //TODO
     */
    @Operation(description = "立即反馈")
    @PutMapping("/ImmediateFeedback")
    public AjaxResult ImmediateFeedback(@RequestBody CldTemporaryReply cldTemporaryReply) {
        return toAjax(miniTemporaryService.insertCldTemporaryReply(cldTemporaryReply));
    }

    /**
     * @Author Shaw
     * @Description 确认完成、撤销、驳回
     * @date: 2025-06-20 9:31
     * @param: //TODO
     */
    @Operation(description = "确认完成、撤销、驳回")
    @PutMapping("/auditTemporary")
    public AjaxResult auditTemporary(@RequestBody CldTemporaryVo cldTemporaryVo) {
        return toAjax(miniTemporaryService.auditTemporary(cldTemporaryVo));
    }
}